package cn.tedu.spring.life;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * BeanFactoryPostProcessor: Bean工厂后置处理器
 * Spring官方不建议自行处理的！
 */
//@Component
public class MyBFPP implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        /**
         * ConfigurableListableBeanFactory里面封装了所有关于Bean的定义信息！！！
         */
        String[] names = configurableListableBeanFactory.getBeanDefinitionNames();
        for (String name : names) {
            System.out.println(name);
        }
    }

}
